class Place < ActiveRecord::Base
  def self.columns() @columns ||= []; end

  def self.column(name, sql_type = nil, default = nil, null = true)
    columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
  end

  column :title, :string
  column :phone, :string
  
  #validates_format_of :from_email, :to_email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i

  validates_presence_of :title, :phone
  validates_length_of :title, :minimum => 3
    
  #belongs_to :article
  has_one :address

  accepts_nested_attributes_for :address
  
end                                                                                       